package com.googlecode.droidjni;

import android.app.*;
import android.content.*;

import java.util.*;

@SuppressWarnings({"unused"})
public final class App extends Application {

    public void onCreate() {
        Intent i = new Intent(this, TraceService.class);
        i.putExtra("extra", "init data for the service");
        startService(i);

        // start service every 30 seconds if system kills it
        Calendar cal = Calendar.getInstance();
        Intent intent = new Intent(this, TraceService.class);
        PendingIntent pi = PendingIntent.getService(this, 0, intent, 0);
        AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
        alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 30*1000, pi);
    }


}